/*
package 线程池案例;


import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

class MyThreadPool {
    private BlockingQueue<Runnable> queue = new LinkedBlockingQueue<>();
    private int ThreadMaxCount = 10;
    public void submit(Runnable task) throws InterruptedException {
        queue.put(task);
    }
    public MyThreadPool() {
        for(int i = 0; i < ThreadMaxCount; i++){
            Thread t = new Thread(new Runnable() {
                @Override
                public void run() {
                    while(true){
                        try {
                            queue.take().run();
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                    }
                }
            });
            t.start();
        }
    }

}

public class Test3 {
    public static void main(String[] args) throws InterruptedException {
        MyThreadPool myThreadPool = new MyThreadPool();
        for(int i = 1; i <= 50; i++){
            int k = i;
            myThreadPool.submit(new Runnable() {
                @Override
                public void run() {
                    System.out.println("线程:" + Thread.currentThread().getName() + "拿到任务:" + k);
                }
            });
        }
    }
}
*/
